// -*- coding: utf-8 -*-
#ifndef DIFFHIGHLIGHTER_H
#define DIFFHIGHLIGHTER_H

#include <QSyntaxHighlighter>
#include <QTextDocument>
#include <QRegExp>
#include <QTextCharFormat>
#include <QPair>

class DiffHighlighter : public QSyntaxHighlighter
{
    Q_OBJECT
public:
    explicit DiffHighlighter(QTextDocument *parent = nullptr);
    
    // 设置需要高亮的行号
    void setHighlightLines(const QList<int> &lines);
    
    // 清除高亮
    void clearHighlight();

protected:
    void highlightBlock(const QString &text) override;

private:
    QList<int> m_highlightLines;
    QTextCharFormat m_diffFormat;
};

#endif // DIFFHIGHLIGHTER_H